/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */

package cn.webrx;

import java.util.Scanner;

/**
 * <p>Project: jse2303 - Ex1
 * <p>Powered by webrx On 2023-07-18 11:47:45
 * <p>描述：<p>
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Ex1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入姓名：");
        String name = sc.nextLine().replace(" ", "");
        String p = "([a-zA-Z ]+|[\\u4e00-\\u9fa5 ]+)";
        if (name.matches(p)) {
            System.out.printf("注册成功，欢迎：%s。%n", name);
        } else {
            System.err.printf("注册失败，姓名必须全中文 或 全英文，不能是中央混合。%n");
        }
    }
}
